ChannelService    = Packages.com.google.appengine.api.channel.ChannelService;
ChannelServiceFactory = Packages.com.google.appengine.api.channel.ChannelServiceFactory;
ChannelMessage = Packages.com.google.appengine.api.channel.ChannelMessage;
function main( hh ) {

  var trans ={
   "id":200002,
   "userAgent":"ANDROID",
   "subType":"in",
   "longDate":1.318926121273E12,
   "userId":"casolla.alessandro@gmail.com",
   "refId":"ag9jb252LW1vYmlsZS1tZ3JyEwsSC0V2ZW50RW50aXR5GJGqDAyiAQdERVZFTE9Q",
   "lng":14.7424505,
   "attributes":"{\"customer\":\"Enel\"}",
   "type":"badge",
   "lat":40.92185585
 };
 
  
 //return toJSON(trans);
  
  
 var msg = new ChannelMessage( "badge" , "test");
 var channelService = ChannelServiceFactory.getChannelService();
 channelService.sendMessage(msg); 

 return "pok"; 
}